import { DataTypes } from 'sequelize';
import seq from '../db/seq';
import moment from 'moment';

const Menu = seq.define('menu', {
    parent_id: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: false,
        comment: "父级菜单"
    },
    name: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true,
        comment: '菜单名称,需唯一'
    },
    icon: {
        type: DataTypes.STRING,
        allowNull: true,
        unique: false,
        comment: '菜单icon 允许为空'
    },
    orderNum: {
        type: DataTypes.TINYINT,
        allowNull: false,
        unique: false,
        defaultValue: 0,
        comment: '菜单排序 0最大'
    },
    path: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true,
        comment: '菜单路由 唯一'
    },
    type: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: false,
        comment: '菜单类型 M目录菜单 C子菜单 F按钮'
    },
    extend: {
        type: DataTypes.BOOLEAN,
        allowNull: false,
        unique: false,
        defaultValue: false,
        comment: '菜单是否可以跳出 true可跳出 默认false '
    },
    show:{
        type: DataTypes.BOOLEAN,
        allowNull: false,
        unique: false,
        defaultValue: true,
        comment: '菜单是否展示 true展示 默认true'
    }
}, {
    tableName: 'menu',
    createdAt: "createTime",
    updatedAt: "updateTime",
})

// Menu.sync({force:true});
export default Menu;
